package plugins

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

func Authentication() gin.HandlerFunc {
	return func(c *gin.Context) {
		token := c.Request.Header.Get("token")
		if token == "" {
			c.Redirect(http.StatusFound, "/login")
			return
		}
		c.Next()
	}
}
